// Copyright (c) Lawrence Livermore National Security, LLC and other VisIt
// Project developers.  See the top-level LICENSE file for dates and other
// details.  No copyright assignment is required to contribute to VisIt.

#include <PyCreateBondsAttributes.h>
#include <ObserverToCallback.h>
#include <stdio.h>
#include <Py2and3Support.h>

// ****************************************************************************
// Module: PyCreateBondsAttributes
//
// Purpose:
//   Attributes for the CreateBondsOperator
//
// Note:       Autogenerated by xml2python. Do not modify by hand!
//
// Programmer: xml2python
// Creation:   omitted
//
// ****************************************************************************

//
// This struct contains the Python type information and a CreateBondsAttributes.
//
struct CreateBondsAttributesObject
{
    PyObject_HEAD
    CreateBondsAttributes *data;
    bool        owns;
    PyObject   *parent;
};

//
// Internal prototypes
//
static PyObject *NewCreateBondsAttributes(int);
std::string
PyCreateBondsAttributes_ToString(const CreateBondsAttributes *atts, const char *prefix, const bool forLogging)
{
    std::string str;
    char tmpStr[1000];

    snprintf(tmpStr, 1000, "%selementVariable = \"%s\"\n", prefix, atts->GetElementVariable().c_str());
    str += tmpStr;
    {   const intVector &atomicNumber1 = atts->GetAtomicNumber1();
        snprintf(tmpStr, 1000, "%satomicNumber1 = (", prefix);
        str += tmpStr;
        for(size_t i = 0; i < atomicNumber1.size(); ++i)
        {
            snprintf(tmpStr, 1000, "%d", atomicNumber1[i]);
            str += tmpStr;
            if(i < atomicNumber1.size() - 1)
            {
                snprintf(tmpStr, 1000, ", ");
                str += tmpStr;
            }
        }
        snprintf(tmpStr, 1000, ")\n");
        str += tmpStr;
    }
    {   const intVector &atomicNumber2 = atts->GetAtomicNumber2();
        snprintf(tmpStr, 1000, "%satomicNumber2 = (", prefix);
        str += tmpStr;
        for(size_t i = 0; i < atomicNumber2.size(); ++i)
        {
            snprintf(tmpStr, 1000, "%d", atomicNumber2[i]);
            str += tmpStr;
            if(i < atomicNumber2.size() - 1)
            {
                snprintf(tmpStr, 1000, ", ");
                str += tmpStr;
            }
        }
        snprintf(tmpStr, 1000, ")\n");
        str += tmpStr;
    }
    {   const doubleVector &minDist = atts->GetMinDist();
        snprintf(tmpStr, 1000, "%sminDist = (", prefix);
        str += tmpStr;
        for(size_t i = 0; i < minDist.size(); ++i)
        {
            snprintf(tmpStr, 1000, "%g", minDist[i]);
            str += tmpStr;
            if(i < minDist.size() - 1)
            {
                snprintf(tmpStr, 1000, ", ");
                str += tmpStr;
            }
        }
        snprintf(tmpStr, 1000, ")\n");
        str += tmpStr;
    }
    {   const doubleVector &maxDist = atts->GetMaxDist();
        snprintf(tmpStr, 1000, "%smaxDist = (", prefix);
        str += tmpStr;
        for(size_t i = 0; i < maxDist.size(); ++i)
        {
            snprintf(tmpStr, 1000, "%g", maxDist[i]);
            str += tmpStr;
            if(i < maxDist.size() - 1)
            {
                snprintf(tmpStr, 1000, ", ");
                str += tmpStr;
            }
        }
        snprintf(tmpStr, 1000, ")\n");
        str += tmpStr;
    }
    snprintf(tmpStr, 1000, "%smaxBondsClamp = %d\n", prefix, atts->GetMaxBondsClamp());
    str += tmpStr;
    if(atts->GetAddPeriodicBonds())
        snprintf(tmpStr, 1000, "%saddPeriodicBonds = 1\n", prefix);
    else
        snprintf(tmpStr, 1000, "%saddPeriodicBonds = 0\n", prefix);
    str += tmpStr;
    if(atts->GetUseUnitCellVectors())
        snprintf(tmpStr, 1000, "%suseUnitCellVectors = 1\n", prefix);
    else
        snprintf(tmpStr, 1000, "%suseUnitCellVectors = 0\n", prefix);
    str += tmpStr;
    if(atts->GetPeriodicInX())
        snprintf(tmpStr, 1000, "%speriodicInX = 1\n", prefix);
    else
        snprintf(tmpStr, 1000, "%speriodicInX = 0\n", prefix);
    str += tmpStr;
    if(atts->GetPeriodicInY())
        snprintf(tmpStr, 1000, "%speriodicInY = 1\n", prefix);
    else
        snprintf(tmpStr, 1000, "%speriodicInY = 0\n", prefix);
    str += tmpStr;
    if(atts->GetPeriodicInZ())
        snprintf(tmpStr, 1000, "%speriodicInZ = 1\n", prefix);
    else
        snprintf(tmpStr, 1000, "%speriodicInZ = 0\n", prefix);
    str += tmpStr;
    {   const double *xVector = atts->GetXVector();
        snprintf(tmpStr, 1000, "%sxVector = (", prefix);
        str += tmpStr;
        for(int i = 0; i < 3; ++i)
        {
            snprintf(tmpStr, 1000, "%g", xVector[i]);
            str += tmpStr;
            if(i < 2)
            {
                snprintf(tmpStr, 1000, ", ");
                str += tmpStr;
            }
        }
        snprintf(tmpStr, 1000, ")\n");
        str += tmpStr;
    }
    {   const double *yVector = atts->GetYVector();
        snprintf(tmpStr, 1000, "%syVector = (", prefix);
        str += tmpStr;
        for(int i = 0; i < 3; ++i)
        {
            snprintf(tmpStr, 1000, "%g", yVector[i]);
            str += tmpStr;
            if(i < 2)
            {
                snprintf(tmpStr, 1000, ", ");
                str += tmpStr;
            }
        }
        snprintf(tmpStr, 1000, ")\n");
        str += tmpStr;
    }
    {   const double *zVector = atts->GetZVector();
        snprintf(tmpStr, 1000, "%szVector = (", prefix);
        str += tmpStr;
        for(int i = 0; i < 3; ++i)
        {
            snprintf(tmpStr, 1000, "%g", zVector[i]);
            str += tmpStr;
            if(i < 2)
            {
                snprintf(tmpStr, 1000, ", ");
                str += tmpStr;
            }
        }
        snprintf(tmpStr, 1000, ")\n");
        str += tmpStr;
    }
    return str;
}

static PyObject *
CreateBondsAttributes_Notify(PyObject *self, PyObject *args)
{
    CreateBondsAttributesObject *obj = (CreateBondsAttributesObject *)self;
    obj->data->Notify();
    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
CreateBondsAttributes_SetElementVariable(PyObject *self, PyObject *args)
{
    CreateBondsAttributesObject *obj = (CreateBondsAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged as first member of a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyUnicode_Check(packaged_args))
            args = packaged_args;
    }

    if (!PyUnicode_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a unicode string");
    }

    char const *val = PyUnicode_AsUTF8(args);
    std::string cval = std::string(val);

    if (val == 0 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as utf8 string");
    }

    Py_XDECREF(packaged_args);

    // Set the elementVariable in the object.
    obj->data->SetElementVariable(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
CreateBondsAttributes_GetElementVariable(PyObject *self, PyObject *args)
{
    CreateBondsAttributesObject *obj = (CreateBondsAttributesObject *)self;
    PyObject *retval = PyString_FromString(obj->data->GetElementVariable().c_str());
    return retval;
}

/*static*/ PyObject *
CreateBondsAttributes_SetAtomicNumber1(PyObject *self, PyObject *args)
{
    CreateBondsAttributesObject *obj = (CreateBondsAttributesObject *)self;

    intVector vec;

    if (PyNumber_Check(args))
    {
        long val = PyLong_AsLong(args);
        int cval = int(val);
        if (val == -1 && PyErr_Occurred())
        {
            PyErr_Clear();
            return PyErr_Format(PyExc_TypeError, "number not interpretable as C++ int");
        }
        if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
            return PyErr_Format(PyExc_ValueError, "number not interpretable as C++ int");
        vec.resize(1);
        vec[0] = cval;
    }
    else if (PySequence_Check(args) && !PyUnicode_Check(args))
    {
        vec.resize(PySequence_Size(args));
        for (Py_ssize_t i = 0; i < PySequence_Size(args); i++)
        {
            PyObject *item = PySequence_GetItem(args, i);

            if (!PyNumber_Check(item))
            {
                Py_DECREF(item);
                return PyErr_Format(PyExc_TypeError, "arg %d is not a number type", (int) i);
            }

            long val = PyLong_AsLong(item);
            int cval = int(val);

            if (val == -1 && PyErr_Occurred())
            {
                Py_DECREF(item);
                PyErr_Clear();
                return PyErr_Format(PyExc_TypeError, "arg %d not interpretable as C++ int", (int) i);
            }
            if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
            {
                Py_DECREF(item);
                return PyErr_Format(PyExc_ValueError, "arg %d not interpretable as C++ int", (int) i);
            }
            Py_DECREF(item);

            vec[i] = cval;
        }
    }
    else
        return PyErr_Format(PyExc_TypeError, "arg(s) must be one or more ints");

    obj->data->GetAtomicNumber1() = vec;
    // Mark the atomicNumber1 in the object as modified.
    obj->data->SelectAtomicNumber1();

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
CreateBondsAttributes_GetAtomicNumber1(PyObject *self, PyObject *args)
{
    CreateBondsAttributesObject *obj = (CreateBondsAttributesObject *)self;
    // Allocate a tuple the with enough entries to hold the atomicNumber1.
    const intVector &atomicNumber1 = obj->data->GetAtomicNumber1();
    PyObject *retval = PyTuple_New(atomicNumber1.size());
    for(size_t i = 0; i < atomicNumber1.size(); ++i)
        PyTuple_SET_ITEM(retval, i, PyInt_FromLong(long(atomicNumber1[i])));
    return retval;
}

/*static*/ PyObject *
CreateBondsAttributes_SetAtomicNumber2(PyObject *self, PyObject *args)
{
    CreateBondsAttributesObject *obj = (CreateBondsAttributesObject *)self;

    intVector vec;

    if (PyNumber_Check(args))
    {
        long val = PyLong_AsLong(args);
        int cval = int(val);
        if (val == -1 && PyErr_Occurred())
        {
            PyErr_Clear();
            return PyErr_Format(PyExc_TypeError, "number not interpretable as C++ int");
        }
        if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
            return PyErr_Format(PyExc_ValueError, "number not interpretable as C++ int");
        vec.resize(1);
        vec[0] = cval;
    }
    else if (PySequence_Check(args) && !PyUnicode_Check(args))
    {
        vec.resize(PySequence_Size(args));
        for (Py_ssize_t i = 0; i < PySequence_Size(args); i++)
        {
            PyObject *item = PySequence_GetItem(args, i);

            if (!PyNumber_Check(item))
            {
                Py_DECREF(item);
                return PyErr_Format(PyExc_TypeError, "arg %d is not a number type", (int) i);
            }

            long val = PyLong_AsLong(item);
            int cval = int(val);

            if (val == -1 && PyErr_Occurred())
            {
                Py_DECREF(item);
                PyErr_Clear();
                return PyErr_Format(PyExc_TypeError, "arg %d not interpretable as C++ int", (int) i);
            }
            if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
            {
                Py_DECREF(item);
                return PyErr_Format(PyExc_ValueError, "arg %d not interpretable as C++ int", (int) i);
            }
            Py_DECREF(item);

            vec[i] = cval;
        }
    }
    else
        return PyErr_Format(PyExc_TypeError, "arg(s) must be one or more ints");

    obj->data->GetAtomicNumber2() = vec;
    // Mark the atomicNumber2 in the object as modified.
    obj->data->SelectAtomicNumber2();

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
CreateBondsAttributes_GetAtomicNumber2(PyObject *self, PyObject *args)
{
    CreateBondsAttributesObject *obj = (CreateBondsAttributesObject *)self;
    // Allocate a tuple the with enough entries to hold the atomicNumber2.
    const intVector &atomicNumber2 = obj->data->GetAtomicNumber2();
    PyObject *retval = PyTuple_New(atomicNumber2.size());
    for(size_t i = 0; i < atomicNumber2.size(); ++i)
        PyTuple_SET_ITEM(retval, i, PyInt_FromLong(long(atomicNumber2[i])));
    return retval;
}

/*static*/ PyObject *
CreateBondsAttributes_SetMinDist(PyObject *self, PyObject *args)
{
    CreateBondsAttributesObject *obj = (CreateBondsAttributesObject *)self;

    doubleVector vec;

    if (PyNumber_Check(args))
    {
        double val = PyFloat_AsDouble(args);
        double cval = double(val);
        if (val == -1 && PyErr_Occurred())
        {
            PyErr_Clear();
            return PyErr_Format(PyExc_TypeError, "number not interpretable as C++ double");
        }
        if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
            return PyErr_Format(PyExc_ValueError, "number not interpretable as C++ double");
        vec.resize(1);
        vec[0] = cval;
    }
    else if (PySequence_Check(args) && !PyUnicode_Check(args))
    {
        vec.resize(PySequence_Size(args));
        for (Py_ssize_t i = 0; i < PySequence_Size(args); i++)
        {
            PyObject *item = PySequence_GetItem(args, i);

            if (!PyNumber_Check(item))
            {
                Py_DECREF(item);
                return PyErr_Format(PyExc_TypeError, "arg %d is not a number type", (int) i);
            }

            double val = PyFloat_AsDouble(item);
            double cval = double(val);

            if (val == -1 && PyErr_Occurred())
            {
                Py_DECREF(item);
                PyErr_Clear();
                return PyErr_Format(PyExc_TypeError, "arg %d not interpretable as C++ double", (int) i);
            }
            if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
            {
                Py_DECREF(item);
                return PyErr_Format(PyExc_ValueError, "arg %d not interpretable as C++ double", (int) i);
            }
            Py_DECREF(item);

            vec[i] = cval;
        }
    }
    else
        return PyErr_Format(PyExc_TypeError, "arg(s) must be one or more doubles");

    obj->data->GetMinDist() = vec;
    // Mark the minDist in the object as modified.
    obj->data->SelectMinDist();

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
CreateBondsAttributes_GetMinDist(PyObject *self, PyObject *args)
{
    CreateBondsAttributesObject *obj = (CreateBondsAttributesObject *)self;
    // Allocate a tuple the with enough entries to hold the minDist.
    const doubleVector &minDist = obj->data->GetMinDist();
    PyObject *retval = PyTuple_New(minDist.size());
    for(size_t i = 0; i < minDist.size(); ++i)
        PyTuple_SET_ITEM(retval, i, PyFloat_FromDouble(minDist[i]));
    return retval;
}

/*static*/ PyObject *
CreateBondsAttributes_SetMaxDist(PyObject *self, PyObject *args)
{
    CreateBondsAttributesObject *obj = (CreateBondsAttributesObject *)self;

    doubleVector vec;

    if (PyNumber_Check(args))
    {
        double val = PyFloat_AsDouble(args);
        double cval = double(val);
        if (val == -1 && PyErr_Occurred())
        {
            PyErr_Clear();
            return PyErr_Format(PyExc_TypeError, "number not interpretable as C++ double");
        }
        if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
            return PyErr_Format(PyExc_ValueError, "number not interpretable as C++ double");
        vec.resize(1);
        vec[0] = cval;
    }
    else if (PySequence_Check(args) && !PyUnicode_Check(args))
    {
        vec.resize(PySequence_Size(args));
        for (Py_ssize_t i = 0; i < PySequence_Size(args); i++)
        {
            PyObject *item = PySequence_GetItem(args, i);

            if (!PyNumber_Check(item))
            {
                Py_DECREF(item);
                return PyErr_Format(PyExc_TypeError, "arg %d is not a number type", (int) i);
            }

            double val = PyFloat_AsDouble(item);
            double cval = double(val);

            if (val == -1 && PyErr_Occurred())
            {
                Py_DECREF(item);
                PyErr_Clear();
                return PyErr_Format(PyExc_TypeError, "arg %d not interpretable as C++ double", (int) i);
            }
            if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
            {
                Py_DECREF(item);
                return PyErr_Format(PyExc_ValueError, "arg %d not interpretable as C++ double", (int) i);
            }
            Py_DECREF(item);

            vec[i] = cval;
        }
    }
    else
        return PyErr_Format(PyExc_TypeError, "arg(s) must be one or more doubles");

    obj->data->GetMaxDist() = vec;
    // Mark the maxDist in the object as modified.
    obj->data->SelectMaxDist();

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
CreateBondsAttributes_GetMaxDist(PyObject *self, PyObject *args)
{
    CreateBondsAttributesObject *obj = (CreateBondsAttributesObject *)self;
    // Allocate a tuple the with enough entries to hold the maxDist.
    const doubleVector &maxDist = obj->data->GetMaxDist();
    PyObject *retval = PyTuple_New(maxDist.size());
    for(size_t i = 0; i < maxDist.size(); ++i)
        PyTuple_SET_ITEM(retval, i, PyFloat_FromDouble(maxDist[i]));
    return retval;
}

/*static*/ PyObject *
CreateBondsAttributes_SetMaxBondsClamp(PyObject *self, PyObject *args)
{
    CreateBondsAttributesObject *obj = (CreateBondsAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    int cval = int(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ int");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ int");
    }

    Py_XDECREF(packaged_args);

    // Set the maxBondsClamp in the object.
    obj->data->SetMaxBondsClamp(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
CreateBondsAttributes_GetMaxBondsClamp(PyObject *self, PyObject *args)
{
    CreateBondsAttributesObject *obj = (CreateBondsAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(long(obj->data->GetMaxBondsClamp()));
    return retval;
}

/*static*/ PyObject *
CreateBondsAttributes_SetAddPeriodicBonds(PyObject *self, PyObject *args)
{
    CreateBondsAttributesObject *obj = (CreateBondsAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    bool cval = bool(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ bool");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ bool");
    }

    Py_XDECREF(packaged_args);

    // Set the addPeriodicBonds in the object.
    obj->data->SetAddPeriodicBonds(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
CreateBondsAttributes_GetAddPeriodicBonds(PyObject *self, PyObject *args)
{
    CreateBondsAttributesObject *obj = (CreateBondsAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(obj->data->GetAddPeriodicBonds()?1L:0L);
    return retval;
}

/*static*/ PyObject *
CreateBondsAttributes_SetUseUnitCellVectors(PyObject *self, PyObject *args)
{
    CreateBondsAttributesObject *obj = (CreateBondsAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    bool cval = bool(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ bool");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ bool");
    }

    Py_XDECREF(packaged_args);

    // Set the useUnitCellVectors in the object.
    obj->data->SetUseUnitCellVectors(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
CreateBondsAttributes_GetUseUnitCellVectors(PyObject *self, PyObject *args)
{
    CreateBondsAttributesObject *obj = (CreateBondsAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(obj->data->GetUseUnitCellVectors()?1L:0L);
    return retval;
}

/*static*/ PyObject *
CreateBondsAttributes_SetPeriodicInX(PyObject *self, PyObject *args)
{
    CreateBondsAttributesObject *obj = (CreateBondsAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    bool cval = bool(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ bool");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ bool");
    }

    Py_XDECREF(packaged_args);

    // Set the periodicInX in the object.
    obj->data->SetPeriodicInX(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
CreateBondsAttributes_GetPeriodicInX(PyObject *self, PyObject *args)
{
    CreateBondsAttributesObject *obj = (CreateBondsAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(obj->data->GetPeriodicInX()?1L:0L);
    return retval;
}

/*static*/ PyObject *
CreateBondsAttributes_SetPeriodicInY(PyObject *self, PyObject *args)
{
    CreateBondsAttributesObject *obj = (CreateBondsAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    bool cval = bool(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ bool");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ bool");
    }

    Py_XDECREF(packaged_args);

    // Set the periodicInY in the object.
    obj->data->SetPeriodicInY(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
CreateBondsAttributes_GetPeriodicInY(PyObject *self, PyObject *args)
{
    CreateBondsAttributesObject *obj = (CreateBondsAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(obj->data->GetPeriodicInY()?1L:0L);
    return retval;
}

/*static*/ PyObject *
CreateBondsAttributes_SetPeriodicInZ(PyObject *self, PyObject *args)
{
    CreateBondsAttributesObject *obj = (CreateBondsAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    bool cval = bool(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ bool");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ bool");
    }

    Py_XDECREF(packaged_args);

    // Set the periodicInZ in the object.
    obj->data->SetPeriodicInZ(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
CreateBondsAttributes_GetPeriodicInZ(PyObject *self, PyObject *args)
{
    CreateBondsAttributesObject *obj = (CreateBondsAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(obj->data->GetPeriodicInZ()?1L:0L);
    return retval;
}

/*static*/ PyObject *
CreateBondsAttributes_SetXVector(PyObject *self, PyObject *args)
{
    CreateBondsAttributesObject *obj = (CreateBondsAttributesObject *)self;

    PyObject *packaged_args = 0;
    double *vals = obj->data->GetXVector();

    if (!PySequence_Check(args) || PyUnicode_Check(args))
        return PyErr_Format(PyExc_TypeError, "Expecting a sequence of numeric args");

    // break open args seq. if we think it matches this API's needs
    if (PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PySequence_Check(packaged_args) && !PyUnicode_Check(packaged_args) &&
            PySequence_Size(packaged_args) == 3)
            args = packaged_args;
    }

    if (PySequence_Size(args) != 3)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "Expecting 3 numeric args");
    }

    for (Py_ssize_t i = 0; i < PySequence_Size(args); i++)
    {
        PyObject *item = PySequence_GetItem(args, i);

        if (!PyNumber_Check(item))
        {
            Py_DECREF(item);
            Py_XDECREF(packaged_args);
            return PyErr_Format(PyExc_TypeError, "arg %d is not a number type", (int) i);
        }

        double val = PyFloat_AsDouble(item);
        double cval = double(val);

        if (val == -1 && PyErr_Occurred())
        {
            Py_XDECREF(packaged_args);
            Py_DECREF(item);
            PyErr_Clear();
            return PyErr_Format(PyExc_TypeError, "arg %d not interpretable as C++ double", (int) i);
        }
        if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
        {
            Py_XDECREF(packaged_args);
            Py_DECREF(item);
            return PyErr_Format(PyExc_ValueError, "arg %d not interpretable as C++ double", (int) i);
        }
        Py_DECREF(item);

        vals[i] = cval;
    }

    Py_XDECREF(packaged_args);

    // Mark the xVector in the object as modified.
    obj->data->SelectXVector();

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
CreateBondsAttributes_GetXVector(PyObject *self, PyObject *args)
{
    CreateBondsAttributesObject *obj = (CreateBondsAttributesObject *)self;
    // Allocate a tuple the with enough entries to hold the xVector.
    PyObject *retval = PyTuple_New(3);
    const double *xVector = obj->data->GetXVector();
    for(int i = 0; i < 3; ++i)
        PyTuple_SET_ITEM(retval, i, PyFloat_FromDouble(xVector[i]));
    return retval;
}

/*static*/ PyObject *
CreateBondsAttributes_SetYVector(PyObject *self, PyObject *args)
{
    CreateBondsAttributesObject *obj = (CreateBondsAttributesObject *)self;

    PyObject *packaged_args = 0;
    double *vals = obj->data->GetYVector();

    if (!PySequence_Check(args) || PyUnicode_Check(args))
        return PyErr_Format(PyExc_TypeError, "Expecting a sequence of numeric args");

    // break open args seq. if we think it matches this API's needs
    if (PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PySequence_Check(packaged_args) && !PyUnicode_Check(packaged_args) &&
            PySequence_Size(packaged_args) == 3)
            args = packaged_args;
    }

    if (PySequence_Size(args) != 3)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "Expecting 3 numeric args");
    }

    for (Py_ssize_t i = 0; i < PySequence_Size(args); i++)
    {
        PyObject *item = PySequence_GetItem(args, i);

        if (!PyNumber_Check(item))
        {
            Py_DECREF(item);
            Py_XDECREF(packaged_args);
            return PyErr_Format(PyExc_TypeError, "arg %d is not a number type", (int) i);
        }

        double val = PyFloat_AsDouble(item);
        double cval = double(val);

        if (val == -1 && PyErr_Occurred())
        {
            Py_XDECREF(packaged_args);
            Py_DECREF(item);
            PyErr_Clear();
            return PyErr_Format(PyExc_TypeError, "arg %d not interpretable as C++ double", (int) i);
        }
        if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
        {
            Py_XDECREF(packaged_args);
            Py_DECREF(item);
            return PyErr_Format(PyExc_ValueError, "arg %d not interpretable as C++ double", (int) i);
        }
        Py_DECREF(item);

        vals[i] = cval;
    }

    Py_XDECREF(packaged_args);

    // Mark the yVector in the object as modified.
    obj->data->SelectYVector();

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
CreateBondsAttributes_GetYVector(PyObject *self, PyObject *args)
{
    CreateBondsAttributesObject *obj = (CreateBondsAttributesObject *)self;
    // Allocate a tuple the with enough entries to hold the yVector.
    PyObject *retval = PyTuple_New(3);
    const double *yVector = obj->data->GetYVector();
    for(int i = 0; i < 3; ++i)
        PyTuple_SET_ITEM(retval, i, PyFloat_FromDouble(yVector[i]));
    return retval;
}

/*static*/ PyObject *
CreateBondsAttributes_SetZVector(PyObject *self, PyObject *args)
{
    CreateBondsAttributesObject *obj = (CreateBondsAttributesObject *)self;

    PyObject *packaged_args = 0;
    double *vals = obj->data->GetZVector();

    if (!PySequence_Check(args) || PyUnicode_Check(args))
        return PyErr_Format(PyExc_TypeError, "Expecting a sequence of numeric args");

    // break open args seq. if we think it matches this API's needs
    if (PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PySequence_Check(packaged_args) && !PyUnicode_Check(packaged_args) &&
            PySequence_Size(packaged_args) == 3)
            args = packaged_args;
    }

    if (PySequence_Size(args) != 3)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "Expecting 3 numeric args");
    }

    for (Py_ssize_t i = 0; i < PySequence_Size(args); i++)
    {
        PyObject *item = PySequence_GetItem(args, i);

        if (!PyNumber_Check(item))
        {
            Py_DECREF(item);
            Py_XDECREF(packaged_args);
            return PyErr_Format(PyExc_TypeError, "arg %d is not a number type", (int) i);
        }

        double val = PyFloat_AsDouble(item);
        double cval = double(val);

        if (val == -1 && PyErr_Occurred())
        {
            Py_XDECREF(packaged_args);
            Py_DECREF(item);
            PyErr_Clear();
            return PyErr_Format(PyExc_TypeError, "arg %d not interpretable as C++ double", (int) i);
        }
        if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
        {
            Py_XDECREF(packaged_args);
            Py_DECREF(item);
            return PyErr_Format(PyExc_ValueError, "arg %d not interpretable as C++ double", (int) i);
        }
        Py_DECREF(item);

        vals[i] = cval;
    }

    Py_XDECREF(packaged_args);

    // Mark the zVector in the object as modified.
    obj->data->SelectZVector();

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
CreateBondsAttributes_GetZVector(PyObject *self, PyObject *args)
{
    CreateBondsAttributesObject *obj = (CreateBondsAttributesObject *)self;
    // Allocate a tuple the with enough entries to hold the zVector.
    PyObject *retval = PyTuple_New(3);
    const double *zVector = obj->data->GetZVector();
    for(int i = 0; i < 3; ++i)
        PyTuple_SET_ITEM(retval, i, PyFloat_FromDouble(zVector[i]));
    return retval;
}



PyMethodDef PyCreateBondsAttributes_methods[CREATEBONDSATTRIBUTES_NMETH] = {
    {"Notify", CreateBondsAttributes_Notify, METH_VARARGS},
    {"SetElementVariable", CreateBondsAttributes_SetElementVariable, METH_VARARGS},
    {"GetElementVariable", CreateBondsAttributes_GetElementVariable, METH_VARARGS},
    {"SetAtomicNumber1", CreateBondsAttributes_SetAtomicNumber1, METH_VARARGS},
    {"GetAtomicNumber1", CreateBondsAttributes_GetAtomicNumber1, METH_VARARGS},
    {"SetAtomicNumber2", CreateBondsAttributes_SetAtomicNumber2, METH_VARARGS},
    {"GetAtomicNumber2", CreateBondsAttributes_GetAtomicNumber2, METH_VARARGS},
    {"SetMinDist", CreateBondsAttributes_SetMinDist, METH_VARARGS},
    {"GetMinDist", CreateBondsAttributes_GetMinDist, METH_VARARGS},
    {"SetMaxDist", CreateBondsAttributes_SetMaxDist, METH_VARARGS},
    {"GetMaxDist", CreateBondsAttributes_GetMaxDist, METH_VARARGS},
    {"SetMaxBondsClamp", CreateBondsAttributes_SetMaxBondsClamp, METH_VARARGS},
    {"GetMaxBondsClamp", CreateBondsAttributes_GetMaxBondsClamp, METH_VARARGS},
    {"SetAddPeriodicBonds", CreateBondsAttributes_SetAddPeriodicBonds, METH_VARARGS},
    {"GetAddPeriodicBonds", CreateBondsAttributes_GetAddPeriodicBonds, METH_VARARGS},
    {"SetUseUnitCellVectors", CreateBondsAttributes_SetUseUnitCellVectors, METH_VARARGS},
    {"GetUseUnitCellVectors", CreateBondsAttributes_GetUseUnitCellVectors, METH_VARARGS},
    {"SetPeriodicInX", CreateBondsAttributes_SetPeriodicInX, METH_VARARGS},
    {"GetPeriodicInX", CreateBondsAttributes_GetPeriodicInX, METH_VARARGS},
    {"SetPeriodicInY", CreateBondsAttributes_SetPeriodicInY, METH_VARARGS},
    {"GetPeriodicInY", CreateBondsAttributes_GetPeriodicInY, METH_VARARGS},
    {"SetPeriodicInZ", CreateBondsAttributes_SetPeriodicInZ, METH_VARARGS},
    {"GetPeriodicInZ", CreateBondsAttributes_GetPeriodicInZ, METH_VARARGS},
    {"SetXVector", CreateBondsAttributes_SetXVector, METH_VARARGS},
    {"GetXVector", CreateBondsAttributes_GetXVector, METH_VARARGS},
    {"SetYVector", CreateBondsAttributes_SetYVector, METH_VARARGS},
    {"GetYVector", CreateBondsAttributes_GetYVector, METH_VARARGS},
    {"SetZVector", CreateBondsAttributes_SetZVector, METH_VARARGS},
    {"GetZVector", CreateBondsAttributes_GetZVector, METH_VARARGS},
    {NULL, NULL}
};

//
// Type functions
//

static void
CreateBondsAttributes_dealloc(PyObject *v)
{
   CreateBondsAttributesObject *obj = (CreateBondsAttributesObject *)v;
   if(obj->parent != 0)
       Py_DECREF(obj->parent);
   if(obj->owns)
       delete obj->data;
}

static PyObject *CreateBondsAttributes_richcompare(PyObject *self, PyObject *other, int op);
PyObject *
PyCreateBondsAttributes_getattr(PyObject *self, char *name)
{
    if(strcmp(name, "elementVariable") == 0)
        return CreateBondsAttributes_GetElementVariable(self, NULL);
    if(strcmp(name, "atomicNumber1") == 0)
        return CreateBondsAttributes_GetAtomicNumber1(self, NULL);
    if(strcmp(name, "atomicNumber2") == 0)
        return CreateBondsAttributes_GetAtomicNumber2(self, NULL);
    if(strcmp(name, "minDist") == 0)
        return CreateBondsAttributes_GetMinDist(self, NULL);
    if(strcmp(name, "maxDist") == 0)
        return CreateBondsAttributes_GetMaxDist(self, NULL);
    if(strcmp(name, "maxBondsClamp") == 0)
        return CreateBondsAttributes_GetMaxBondsClamp(self, NULL);
    if(strcmp(name, "addPeriodicBonds") == 0)
        return CreateBondsAttributes_GetAddPeriodicBonds(self, NULL);
    if(strcmp(name, "useUnitCellVectors") == 0)
        return CreateBondsAttributes_GetUseUnitCellVectors(self, NULL);
    if(strcmp(name, "periodicInX") == 0)
        return CreateBondsAttributes_GetPeriodicInX(self, NULL);
    if(strcmp(name, "periodicInY") == 0)
        return CreateBondsAttributes_GetPeriodicInY(self, NULL);
    if(strcmp(name, "periodicInZ") == 0)
        return CreateBondsAttributes_GetPeriodicInZ(self, NULL);
    if(strcmp(name, "xVector") == 0)
        return CreateBondsAttributes_GetXVector(self, NULL);
    if(strcmp(name, "yVector") == 0)
        return CreateBondsAttributes_GetYVector(self, NULL);
    if(strcmp(name, "zVector") == 0)
        return CreateBondsAttributes_GetZVector(self, NULL);


    // Add a __dict__ answer so that dir() works
    if (!strcmp(name, "__dict__"))
    {
        PyObject *result = PyDict_New();
        for (int i = 0; PyCreateBondsAttributes_methods[i].ml_meth; i++)
            PyDict_SetItem(result,
                PyString_FromString(PyCreateBondsAttributes_methods[i].ml_name),
                PyString_FromString(PyCreateBondsAttributes_methods[i].ml_name));
        return result;
    }

    return Py_FindMethod(PyCreateBondsAttributes_methods, self, name);
}

int
PyCreateBondsAttributes_setattr(PyObject *self, char *name, PyObject *args)
{
    PyObject NULL_PY_OBJ;
    PyObject *obj = &NULL_PY_OBJ;

    if(strcmp(name, "elementVariable") == 0)
        obj = CreateBondsAttributes_SetElementVariable(self, args);
    else if(strcmp(name, "atomicNumber1") == 0)
        obj = CreateBondsAttributes_SetAtomicNumber1(self, args);
    else if(strcmp(name, "atomicNumber2") == 0)
        obj = CreateBondsAttributes_SetAtomicNumber2(self, args);
    else if(strcmp(name, "minDist") == 0)
        obj = CreateBondsAttributes_SetMinDist(self, args);
    else if(strcmp(name, "maxDist") == 0)
        obj = CreateBondsAttributes_SetMaxDist(self, args);
    else if(strcmp(name, "maxBondsClamp") == 0)
        obj = CreateBondsAttributes_SetMaxBondsClamp(self, args);
    else if(strcmp(name, "addPeriodicBonds") == 0)
        obj = CreateBondsAttributes_SetAddPeriodicBonds(self, args);
    else if(strcmp(name, "useUnitCellVectors") == 0)
        obj = CreateBondsAttributes_SetUseUnitCellVectors(self, args);
    else if(strcmp(name, "periodicInX") == 0)
        obj = CreateBondsAttributes_SetPeriodicInX(self, args);
    else if(strcmp(name, "periodicInY") == 0)
        obj = CreateBondsAttributes_SetPeriodicInY(self, args);
    else if(strcmp(name, "periodicInZ") == 0)
        obj = CreateBondsAttributes_SetPeriodicInZ(self, args);
    else if(strcmp(name, "xVector") == 0)
        obj = CreateBondsAttributes_SetXVector(self, args);
    else if(strcmp(name, "yVector") == 0)
        obj = CreateBondsAttributes_SetYVector(self, args);
    else if(strcmp(name, "zVector") == 0)
        obj = CreateBondsAttributes_SetZVector(self, args);

    if (obj != NULL && obj != &NULL_PY_OBJ)
        Py_DECREF(obj);

    if (obj == &NULL_PY_OBJ)
    {
        obj = NULL;
        PyErr_Format(PyExc_NameError, "name '%s' is not defined", name);
    }
    else if (obj == NULL && !PyErr_Occurred())
        PyErr_Format(PyExc_RuntimeError, "unknown problem with '%s'", name);

    return (obj != NULL) ? 0 : -1;
}

static int
CreateBondsAttributes_print(PyObject *v, FILE *fp, int flags)
{
    CreateBondsAttributesObject *obj = (CreateBondsAttributesObject *)v;
    fprintf(fp, "%s", PyCreateBondsAttributes_ToString(obj->data, "",false).c_str());
    return 0;
}

PyObject *
CreateBondsAttributes_str(PyObject *v)
{
    CreateBondsAttributesObject *obj = (CreateBondsAttributesObject *)v;
    return PyString_FromString(PyCreateBondsAttributes_ToString(obj->data,"", false).c_str());
}

//
// The doc string for the class.
//
#if PY_MAJOR_VERSION > 2 || (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 5)
static const char *CreateBondsAttributes_Purpose = "Attributes for the CreateBondsOperator";
#else
static char *CreateBondsAttributes_Purpose = "Attributes for the CreateBondsOperator";
#endif

//
// Python Type Struct Def Macro from Py2and3Support.h
//
//         VISIT_PY_TYPE_OBJ( VPY_TYPE,
//                            VPY_NAME,
//                            VPY_OBJECT,
//                            VPY_DEALLOC,
//                            VPY_PRINT,
//                            VPY_GETATTR,
//                            VPY_SETATTR,
//                            VPY_STR,
//                            VPY_PURPOSE,
//                            VPY_RICHCOMP,
//                            VPY_AS_NUMBER)

//
// The type description structure
//

VISIT_PY_TYPE_OBJ(CreateBondsAttributesType,         \
                  "CreateBondsAttributes",           \
                  CreateBondsAttributesObject,       \
                  CreateBondsAttributes_dealloc,     \
                  CreateBondsAttributes_print,       \
                  PyCreateBondsAttributes_getattr,   \
                  PyCreateBondsAttributes_setattr,   \
                  CreateBondsAttributes_str,         \
                  CreateBondsAttributes_Purpose,     \
                  CreateBondsAttributes_richcompare, \
                  0); /* as_number*/

//
// Helper function for comparing.
//
static PyObject *
CreateBondsAttributes_richcompare(PyObject *self, PyObject *other, int op)
{
    // only compare against the same type 
    if ( Py_TYPE(self) != &CreateBondsAttributesType
         || Py_TYPE(other) != &CreateBondsAttributesType)
    {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }

    PyObject *res = NULL;
    CreateBondsAttributes *a = ((CreateBondsAttributesObject *)self)->data;
    CreateBondsAttributes *b = ((CreateBondsAttributesObject *)other)->data;

    switch (op)
    {
       case Py_EQ:
           res = (*a == *b) ? Py_True : Py_False;
           break;
       case Py_NE:
           res = (*a != *b) ? Py_True : Py_False;
           break;
       default:
           res = Py_NotImplemented;
           break;
    }

    Py_INCREF(res);
    return res;
}

//
// Helper functions for object allocation.
//

static CreateBondsAttributes *defaultAtts = 0;
static CreateBondsAttributes *currentAtts = 0;

static PyObject *
NewCreateBondsAttributes(int useCurrent)
{
    CreateBondsAttributesObject *newObject;
    newObject = PyObject_NEW(CreateBondsAttributesObject, &CreateBondsAttributesType);
    if(newObject == NULL)
        return NULL;
    if(useCurrent && currentAtts != 0)
        newObject->data = new CreateBondsAttributes(*currentAtts);
    else if(defaultAtts != 0)
        newObject->data = new CreateBondsAttributes(*defaultAtts);
    else
        newObject->data = new CreateBondsAttributes;
    newObject->owns = true;
    newObject->parent = 0;
    return (PyObject *)newObject;
}

static PyObject *
WrapCreateBondsAttributes(const CreateBondsAttributes *attr)
{
    CreateBondsAttributesObject *newObject;
    newObject = PyObject_NEW(CreateBondsAttributesObject, &CreateBondsAttributesType);
    if(newObject == NULL)
        return NULL;
    newObject->data = (CreateBondsAttributes *)attr;
    newObject->owns = false;
    newObject->parent = 0;
    return (PyObject *)newObject;
}

///////////////////////////////////////////////////////////////////////////////
//
// Interface that is exposed to the VisIt module.
//
///////////////////////////////////////////////////////////////////////////////

PyObject *
CreateBondsAttributes_new(PyObject *self, PyObject *args)
{
    int useCurrent = 0;
    if (!PyArg_ParseTuple(args, "i", &useCurrent))
    {
        if (!PyArg_ParseTuple(args, ""))
            return NULL;
        else
            PyErr_Clear();
    }

    return (PyObject *)NewCreateBondsAttributes(useCurrent);
}

//
// Plugin method table. These methods are added to the visitmodule's methods.
//
static PyMethodDef CreateBondsAttributesMethods[] = {
    {"CreateBondsAttributes", CreateBondsAttributes_new, METH_VARARGS},
    {NULL,      NULL}        /* Sentinel */
};

static Observer *CreateBondsAttributesObserver = 0;

std::string
PyCreateBondsAttributes_GetLogString()
{
    std::string s("CreateBondsAtts = CreateBondsAttributes()\n");
    if(currentAtts != 0)
        s += PyCreateBondsAttributes_ToString(currentAtts, "CreateBondsAtts.", true);
    return s;
}

static void
PyCreateBondsAttributes_CallLogRoutine(Subject *subj, void *data)
{
    typedef void (*logCallback)(const std::string &);
    logCallback cb = (logCallback)data;

    if(cb != 0)
    {
        std::string s("CreateBondsAtts = CreateBondsAttributes()\n");
        s += PyCreateBondsAttributes_ToString(currentAtts, "CreateBondsAtts.", true);
        cb(s);
    }
}

void
PyCreateBondsAttributes_StartUp(CreateBondsAttributes *subj, void *data)
{
    if(subj == 0)
        return;

    currentAtts = subj;
    PyCreateBondsAttributes_SetDefaults(subj);

    //
    // Create the observer that will be notified when the attributes change.
    //
    if(CreateBondsAttributesObserver == 0)
    {
        CreateBondsAttributesObserver = new ObserverToCallback(subj,
            PyCreateBondsAttributes_CallLogRoutine, (void *)data);
    }

}

void
PyCreateBondsAttributes_CloseDown()
{
    delete defaultAtts;
    defaultAtts = 0;
    delete CreateBondsAttributesObserver;
    CreateBondsAttributesObserver = 0;
}

PyMethodDef *
PyCreateBondsAttributes_GetMethodTable(int *nMethods)
{
    *nMethods = 1;
    return CreateBondsAttributesMethods;
}

bool
PyCreateBondsAttributes_Check(PyObject *obj)
{
    return (obj->ob_type == &CreateBondsAttributesType);
}

CreateBondsAttributes *
PyCreateBondsAttributes_FromPyObject(PyObject *obj)
{
    CreateBondsAttributesObject *obj2 = (CreateBondsAttributesObject *)obj;
    return obj2->data;
}

PyObject *
PyCreateBondsAttributes_New()
{
    return NewCreateBondsAttributes(0);
}

PyObject *
PyCreateBondsAttributes_Wrap(const CreateBondsAttributes *attr)
{
    return WrapCreateBondsAttributes(attr);
}

void
PyCreateBondsAttributes_SetParent(PyObject *obj, PyObject *parent)
{
    CreateBondsAttributesObject *obj2 = (CreateBondsAttributesObject *)obj;
    obj2->parent = parent;
}

void
PyCreateBondsAttributes_SetDefaults(const CreateBondsAttributes *atts)
{
    if(defaultAtts)
        delete defaultAtts;

    defaultAtts = new CreateBondsAttributes(*atts);
}

